package com.sky.controller.user;

import com.sky.entity.Category;
import com.sky.result.Result;
import com.sky.service.CategoryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Author 梁科
 * @Version 1.0
 * @ Date 2025/10/26 21:40
 */
@Api(tags = "用户端分类相关接口")
@RestController(value = "userCategoryController")
@RequestMapping(value = "/user/category")
@Slf4j
public class CategoryController {
    @Resource
    private CategoryService categoryService;

    /**
     * 根据类型显示分类
     *
     * @param type
     * @return
     */
    @ApiOperation(value = "显示菜品/套餐分类")
    @GetMapping(value = "/list")
    public Result<List<Category>> list( Integer type) {
        List<Category> categories = categoryService.queryDishOrSetmealByCategory(type);
        return Result.success(categories);
    }
}
